package com.myself;


import com.myself.api.CarInterface;
import com.myself.service.BlueCarWapper;
import com.myself.service.BmwCar;
import com.myself.service.RedCarWapper;
import jdk.nashorn.internal.runtime.options.Option;


import java.util.Optional;


/**
 * @author W.S.
 * @version v1.0.0
 * @description
 * @date Created in 2019/3/19 16:00
 */
public class JavaSPI {
    public static void main(String[] args) {
        // ExtensionLoader
        /*ServiceLoader<CarInterface> serviceLoader = ServiceLoader.load(CarInterface.class);
        Iterator<CarInterface> iterator = serviceLoader.iterator();
        while (iterator.hasNext()){
            CarInterface carInterface = iterator.next();
            carInterface.sayBrand();
        }*/
        //test.get();
        System.out.println(Thread.currentThread().getContextClassLoader());
        BlueCarWapper blue = new BlueCarWapper(new BmwCar());
        RedCarWapper red = new RedCarWapper(blue);
        red.sayColor();
    }
}
